//
// Created by 123 on 2025/1/10.
//
#include "functional"
#include "vector"
#include "algorithm"
#include "iostream"

class MyCompare{
public:
    bool operator()(int v1,int v2){
        return v1 > v2;
    }
};

void test(){
    std::vector<int> v1;
    v1.push_back(10);
    v1.push_back(30);
    v1.push_back(20);
    v1.push_back(0);
    for(std::vector<int>::iterator it=v1.begin();it!=v1.end();it++){
        std::cout << *it << " ";
    }
    std::cout << std::endl;
    std::cout << "---------------------------" << std::endl;


    std::sort(v1.begin(),v1.end(),MyCompare());
    for(std::vector<int>::iterator it=v1.begin();it!=v1.end();it++){
        std::cout << *it << " ";
    }
    std::cout << std::endl;
    std::cout << "---------------------------" << std::endl;

    std::sort(v1.begin(),v1.end(),std::greater<int>());
    for(std::vector<int>::iterator it=v1.begin();it!=v1.end();it++){
        std::cout << *it << " ";
    }
    std::cout << std::endl;

}

int main148(){
    test();
    return 0;
}